/**
 * Copyright (c) 2007/2008 by Rowan Rodrik van der Molen
 *
 * This file is part of readline-trainer.
 *
 * readline-trainer is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * at your option) any later version.
 *
 * readline-trainer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with readline-trainer.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef LESSONS_H
#define LESSONS_H


/**
 * An exercise instructs you on how to enter a particular line.
 *
 * XML example:
 * <exercise line="Enter this line">
 *   <instruction>Type "Enter this line" and press Enter</instruction>
 *   <hint>You know how to type, don't you?</hint>
 * </exercise>
 */
typedef struct trrl_exercise
{
    char* instruction;  // The instruction telling you what the exercise entails.
    char* hint;  // A hint that will help you understand the exercise, if you're lucky.
    char* line;  // The line that needs to be entered for the lesson to be deemed successfull.
    struct trrl_exercise* next_exercise;  // The next exercise in row. NULL if this is the last exercise.
} trrl_exercise;
typedef trrl_exercise* trrl_exercise_ptr;


/**
 * A lesson is a group of exercises that is meant to learn you something.
 * Lessons have a number and a title to distinguish them from other lessons.
 *
 * A lesson corrosponds to the <lesson> element in the XML DTD.
 */
typedef struct trrl_lesson
{
    int number;  // The number of the lesson.
    char* title;  // The title of the lesson.
    trrl_exercise_ptr first_exercise;  // Pointer to the first exercise in the lesson.
    struct trrl_lesson* next_lesson;  // Pointer to the next lesson (used during the parsing stage).
} trrl_lesson;
typedef trrl_lesson* trrl_lesson_ptr;


/**
 * Return a pointer to a new exercise, with all the fields initialized to NULL.
 */
trrl_exercise_ptr trrl_new_exercise();


/**
 * Return a pointer to a new lesson, with all pointer fields initialized to NULL and 'number' initialized to zero.
 */
trrl_lesson_ptr trrl_new_lesson();


#endif
// vim: set expandtab tabstop=4 shiftwidth=4:
